<table>
	<tr>
		<td colspan="4" style="text-align: center"><?php echo $my_file_name[0]['items']['file_name']; ?> is shared among those users:</td>
	</tr>
	<tr>
		<th>Name</th>
		<th>Surname</th>
		<th>Email</th>
	</tr>
	<?php foreach ($my_files as $my_file): ?>
	<tr>
		<td><?php echo $my_file['users']['name']; ?></td>
		<td><?php echo $my_file['users']['surname']; ?></td>
		<td><?php echo $my_file['users']['email']; ?></td>
		<td style="text-align: center"><?php echo $this -> Form -> postLink($this -> Html -> image("admin/delete.gif", array("alt" => "delete_user")), array('action' => 'delete_user',$my_file_name[0]['items']['id_file'], $my_file['users']['id_user']), array('escape' => false, 'confirm' => 'Are you sure?')); ?></td>

	</tr>
	<?php endforeach; ?>
</table>
<br/><br/><br/>

<table>
	<tr>
		<td colspan="2" style="text-align: center"><?php echo $my_file_name[0]['items']['file_name']; ?> is shared among those groups:</td>
	</tr>
	<tr>
		<th colspan="2">Group Name</th>
	</tr>
	<?php foreach ($my_groups_files as $my_file): ?>
	<tr>
		<td><?php echo $my_file['groups']['group_name']; ?></td>
		<td style="text-align: center"><?php echo $this -> Form -> postLink($this -> Html -> image("admin/delete.gif", array("alt" => "delete_user")), array('action' => 'delete_group',$my_file_name[0]['items']['id_file'], $my_file['groups']['id_group']), array('escape' => false, 'confirm' => 'Are you sure?')); ?></td>
	</tr>
	<?php endforeach; ?>
</table>

<br/>
<br/>
<br/>
<?php
	//this is the part concern the addition of a user to share a file
	echo $this -> Form -> create('Item', array('action' => 'add_user'));
	echo $this -> Form -> input('email', array('label' => 'Add User Email'));
	echo $this -> Form -> hidden( 'id_file', array( 'value' => $my_file_name[0]['items']['id_file'] ) );
	echo $this -> Form -> end('Submit');
?>
<br/><br/><br/>

<?php
	//this is the part concern the addition of a group to share a file
	echo $this -> Form -> create('Item', array('action' => 'add_group')) ?>
	<p>Group selection<br>
	<select name='data[Item][group]'>
		<?php
		foreach ($groups as $group) {
			echo "<option value='" . $group['groups']['id_group'] . "'>" . $group['groups']['group_name'] . "</option>";
		}
		?>
	</select></p>
<?php
	echo $this -> Form -> hidden( 'id_file', array( 'value' => ''.$my_file_name[0]['items']['id_file'].'' ) );
	echo $this -> Form -> end('Submit');
